﻿@page "/bluetooths"
@namespace BootstrapBlazor.Shared.Samples
@inject IStringLocalizer<Bluetooths> Localizer

<h3>@Localizer["Title"]</h3>

<PackageTips Name="BootstrapBlazor.Bluetooth" /> 

<h5><a href="/bluetooths">@Localizer["Url1"]</a></h5>
<h5><a href="/bluetoothheartrates">@Localizer["Url2"]</a></h5>
<h5><a href="/bluetoothbatterylevels">@Localizer["Url3"]</a></h5>

<Tips>
    <p>@((MarkupString)Localizer["Tips"].Value)</p>
</Tips>

<DemoBlock Title="@Localizer["BaseUsageText"]" Introduction="@Localizer["BaseUsageIntro"]" Name="Nomal">
    @if (ShowUI)
    {
        <span>内置UI</span>

        <Printer OnResult="OnResult" ShowUI="true" OnError="OnError" OnUpdateStatus="OnUpdateStatus" OnUpdateError="OnError" OnGetDevices="OnGetDevices" />

    }
    else
    {
        <span>
            基本用法
        </span>
        <Printer @ref="printer" OnResult="OnResult" OnError="OnError" OnUpdateStatus="OnUpdateStatus" OnUpdateError="OnError" OnGetDevices="OnGetDevices" />
        <div @ref="printer.PrinterElement">
            <button data-action="btnConnect" class="btn btn-outline-primary">@Localizer["ConnectButtonText"]</button>
            <button data-action="btnDisconnect" class="btn btn-outline-danger">@Localizer["DisconnectButtonText"]</button>
            @*<button data-action="btnReconnect" class="btn btn-outline-secondary">@Localizer["ReconnectButtonText"]</button>*@
            <button data-action="tools" class="btn btn-outline-primary" @onclick="printer.Print">@Localizer["PrintButtonText"]</button>
        </div>
    }
    <hr />
    <pre>@message</pre>
    <pre style="color:green">@statusmessage</pre>
    <pre style="color:red">@errmessage</pre>
    <p />
    <button class="btn btn-link" @onclick="SwitchUI ">切换界面</button>
</DemoBlock>

<BluetoothBatteryLevel />
<BluetoothHeartRate />

<AttributeTable Title="Printer 组件" Items="@GetAttributes()" />

<AttributeTable Title="BatteryLevel 组件" Items="@GetAttributesBatteryLevel()" />

<AttributeTable Title="Heartrate 组件" Items="@GetAttributesHeartrate()" />

<AttributeTable Title="BluetoothDevice 类" Items="@GetBluetoothDeviceAttributes()" />

<AttributeTable Title="PrinterOption 类" Items="@GetPrinterOptionAttributes()" />
